package com.itheima.dome.studentmanagementsystem;

import java.util.ArrayList;
import java.util.Scanner;

public class ClassRoom {
    public static ArrayList<Student> classList = new ArrayList<>();

    private ClassRoom() {
    }

    public static ArrayList<Student> getClassList() {
        return classList;
    }

    public static void setClassList(ArrayList<Student> classList) {
        ClassRoom.classList = classList;
    }

    //添加学生
    public void setStudent() {
        Student student=new Student();
        Scanner scanner=new Scanner(System.in);

        System.out.println("请输入姓名");
        student.setName(scanner.next());

        System.out.println("请输学号");
       student.setId(scanner.next());

        System.out.println("请输入年龄");
       student.setAge(scanner.nextInt());
       //---------
        setClassList(student);

    }


    //学生列表
    public void getStudent(){
        if (classList==null){
            System.out.println("当前系统还未储存学生信息，请先添加学生信息");
            return;
        }
        for (int i = 0; i < classList.size(); i++) {
            System.out.println(classList.get(i).toString());
        }
    }


}
